<template>
	<view class="content">
		<view class="phoneContent" style="margin-top: 20rpx;">
			<view class="name">真实姓名</view>
			<input placeholder="请输入真实姓名" placeholder-class="placeholder" class="input" v-model="realName" />
		</view>
		
		<view class="phoneContent">
			<view class="name">身份证号</view>
			<input placeholder="请输入身份证号" placeholder-class="placeholder" class="input" v-model="idNumber" />
		</view>
		
		<view class="loginContent" :class="realName && idNumber?'loginContentSubmit':''" @tap="submit">立即认证</view>
	</view>
</template>

<script>
	import { realNameAuth } from '@/api/api.js'
	export default {
		data() {
			return {
				realName:'',
				idNumber:'',
			}
		},
		
		methods:{
			submit() {
				if( !this.realName ){
					uni.showToast({
						icon:'none',
						title:'请输入真实姓名'
					})
					return false
				}
				if( !this.idNumber ){
					uni.showToast({
						icon:'none',
						title:'请输入身份证号'
					})
					return false
				}
				let data = {
					realName:this.realName,
					idNumber:this.idNumber,
				}
				realNameAuth(data).then( res=> {
					uni.showToast({
						icon:'none',
						title:'认证成功'
					})
					setTimeout(function() {
						uni.switchTab({
							url:'/pages/mine/index'
						})
					},500)
				})
			}
		}
	}
</script>

<style>
	page {
		background-color: #F6F6F8;
	}
</style>
<style lang="less" scoped>
	
	.content {
			display: flex;
			align-items: center;
			flex-direction: column;
			// 手机号
			.phoneContent {
				background-color: #fff;
				position: relative;
				width: 662rpx;
				padding: 28rpx 20rpx 16rpx 28rpx;
				.name {
					font-family: Alibaba PuHuiTi, Alibaba PuHuiTi;
					font-weight: 400;
					font-size: 28rpx;
					color: #000000;
					line-height: 36rpx;
				}
				.placeholder {
					font-family: PingFang SC, PingFang SC;
					font-weight: 500;
					font-size: 26rpx;
					color: #BCBDBD;
					line-height: 26rpx;
				}
				.input {
					margin-top: 24rpx;
					height: 56rpx;
					width: 100%;
					border-bottom: 1rpx solid rgba(249, 249, 249, 1);
				}
				.codeContent {
					position: absolute;
					right: 40rpx;
					bottom: 20rpx;
					font-size: 26rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: rgba(83, 167, 0, 1);
					line-height: 37rpx;
				}
			}
			.loginContent {
				width: 670rpx;
				height: 88rpx;
				background-color: rgba(225, 225, 225, 1);
				border-radius: 45rpx;
				font-size: 28rpx;
				font-family: PingFangSC-Medium, PingFang SC;
				font-weight: 500;
				color: #FFFFFF;
				line-height: 88rpx;
				text-align: center;
				margin-top: 60rpx;
			}
			
			.loginContentSubmit {
				background-color: rgba(83, 167, 0, 1);
			}
		}

</style>
